# -*- coding: utf-8 -*-
"""
插件基类
"""
from abc import ABC, abstractmethod
from PySide6.QtWidgets import QWidget
import sys
import os

# 添加当前目录到路径以便导入样式管理器
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from style_manager import StyleManager


class PluginBase(ABC):
    """插件基类，所有插件都应继承此类"""
    
    def __init__(self):
        self._widget = None
        self._name = ""
        self._version = "1.0.0"
        self._description = ""
        self._author = ""
        self._style_manager = StyleManager
    
    @abstractmethod
    def get_name(self) -> str:
        """获取插件名称"""
        pass
    
    @abstractmethod
    def get_widget(self) -> QWidget:
        """获取插件的主界面部件"""
        pass
    
    def get_version(self) -> str:
        """获取插件版本"""
        return self._version
    
    def get_description(self) -> str:
        """获取插件描述"""
        return self._description
    
    def get_author(self) -> str:
        """获取插件作者"""
        return self._author
    
    def get_style_manager(self):
        """获取样式管理器"""
        return self._style_manager
    
    def activate(self):
        """激活插件时调用"""
        pass
    
    def deactivate(self):
        """停用插件时调用"""
        pass
    
    def initialize(self):
        """初始化插件"""
        pass
    
    def cleanup(self):
        """清理插件资源"""
        pass 